﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace demo07
{
    /*
         *
        ***
       *****
        ***
         *
    */
    class Program7
    {
        static void Main(string[] args)
        {
            bool flag = true;
            int a = 0;

            while (flag)
            {
                try
                {
                    Console.WriteLine("请输入棱形边长：");
                    a = Convert.ToInt32(Console.ReadLine());
                    flag = false;
                }
                catch
                {
                    Console.WriteLine("输入的不是整数，请重新输入");
                }
            }

            for (int i = 0; i < (a * 2) - 1; i++)
            {
                for (int j = 0; j < (a * 2) - 1; j++)
                {
                    if (j >= Math.Abs(a - 1 - i) && j <= (a - 1) * 2 - Math.Abs(a - 1 - i))
                    {
                        Console.Write(" *");
                    }
                    else
                    {
                        Console.Write("  ");
                    }
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}
